package topo.utils;

import java.net.URL;
import javax.swing.ImageIcon;

public class ImageTools {
    public static ImageTools imageTools;

    public static ImageTools getInstance() {
        if (imageTools == null) {
            imageTools = new ImageTools();
        }
        return imageTools;
    }

    public ImageIcon getTypeImage(String imagePath, String imageName) {
        ImageIcon icon = null;
        try {
            URL url = getClass().getClassLoader().getResource(imagePath + imageName);
            icon = new ImageIcon(url);
        } catch (Exception ex) {
            ex.printStackTrace();
        }

        return icon;
    }
}